using UwinEducation.Domain.Entities;
using UwinEducation.Shared.Models;

namespace UwinEducation.Domain.IRepositories
{
    /// <summary>
    /// 教师档期仓储接口
    /// </summary>
    public interface ITeacherAvailabilityRepository : IRepository<TeacherAvailability, Guid>
    {
        /// <summary>
        /// 获取教师档期分页列表
        /// </summary>
        Task<PagedResult<TeacherAvailability>> GetPagedListAsync(TeacherAvailabilityPageRequest pageRequest);

        /// <summary>
        /// 获取教师档期分页列表（按是否有排课排序）
        /// </summary>
        /// <param name="pageRequest">分页请求</param>
        /// <returns>排序后的教师档期分页结果</returns>
        Task<PagedResult<TeacherAvailability>> GetPagedListWithScheduleStatusAsync(TeacherAvailabilityPageRequest pageRequest);

        /// <summary>
        /// 获取教师档期详情
        /// </summary>
        Task<TeacherAvailability> GetDetailsByIdAsync(Guid id);

        /// <summary>
        /// 获取教师的档期列表
        /// </summary>
        Task<List<TeacherAvailability>> GetByTeacherIdAsync(Guid teacherId);

        /// <summary>
        /// 获取指定日期范围内的教师档期
        /// </summary>
        Task<List<TeacherAvailability>> GetByDateRangeAsync(Guid teacherId, DateTime startDate, DateTime endDate);

        Task<List<TeacherAvailability>> GetByDateRangeAsync(DateTime startDate, DateTime endDate);

        /// <summary>
        /// 检查时间段是否有冲突
        /// </summary>
        Task<bool> HasTimeConflictAsync(Guid teacherId, DateTime startDate, DateTime endDate, int dayOfWeek, TimeSpan startTime, TimeSpan endTime, Guid? excludeId = null);

        /// <summary>
        /// 批量添加教师档期
        /// </summary>
        //Task AddRangeAsync(List<TeacherAvailability> availabilities);

        /// <summary>
        /// 使用SQL批量添加教师档期（高性能）
        /// </summary>
        Task BulkInsertAsync(List<TeacherAvailability> availabilities);

        /// <summary>
        /// 删除教师所有档期
        /// </summary>
        Task DeleteByTeacherIdAsync(Guid teacherId);
    }
}